//
//  NETSConfig.m
//  Bees
//
//  Created by NowYouCanSee on 2019/3/21.
//  Copyright © 2019 xiaohan. All rights reserved.
//

#import "NETSConfig.h"

@implementation NETSConfig
+ (instancetype)sharedConfig
{
    static NETSConfig *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[NETSConfig alloc] init];
    });
    return instance;
}

- (instancetype)init
{
    if (self = [super init])
    {
        _appKey = kNIMSDKAPPKEY;
        _apiURL = @"";
        _apnsCername = kNIMPushName;
        _pkCername = @"";
        
        _redPacketConfig = [[NTESRedPacketConfig alloc] init];
    }
    return self;
}

- (NSString *)apiURL
{
    NSAssert([[NIMSDK sharedSDK] isUsingDemoAppKey], @"只有 demo appKey 才能够使用这个API接口");
    return _apiURL;
}

- (void)registerConfig:(NSDictionary *)config
{
    if (config[@"red_packet_online"])
    {
        _redPacketConfig.useOnlineEnv = [config[@"red_packet_online"] boolValue];
    }
}


@end



@implementation NTESRedPacketConfig

- (instancetype)init
{
    self = [super init];
    if (self)
    {
        _useOnlineEnv = YES;
        _aliPaySchemeUrl = @"";
        _weChatSchemeUrl = @"";
    }
    return self;
}
@end
